package com.hunk.time.model;

import java.math.BigDecimal;

public class Fruit {

    //水果名称
    private String name;
    //水果价格
    private BigDecimal price;

    public Fruit(String name, BigDecimal price) {
        if (name == null || "".equals(name)) throw new RuntimeException("水果名称不能为空");
        if (price == null || price.compareTo(new BigDecimal(0)) < 0) throw new RuntimeException("水果价格不能低于0元");
        this.name = name;
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }
}
